package com.vitech.javacertification.threads.hungrybirds;

public class Genesis {

	public static void main(String args[]) throws InterruptedException {

		System.out
				.println("And God create the dish of worms to feed the birds ... \n");
		WormsDish wormsDish = new WormsDish();

		System.out.println("And God create the mommy brid ... \n");
		MotherBird parent = new MotherBird(wormsDish);
		parent.setName("Mommy");
		
		parent.start();
		
		System.out
				.println("And God made the momy bird to defecate 3 eggs from which 3 Hungry birds were born ... \n");

		BabyBird baby[] = new BabyBird[3];
		
		// babies start to eat / sleep seqeuence
		for (int i = 0; i < 3; i++) {
			baby[i] = new BabyBird(wormsDish, parent);
			System.out.println("Baby " + i + " birth");
			baby[i].setName("baby " + i);
			baby[i].start();
			baby[i].join();
		}
	}

}
